package com.diandian.controller;


import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * @description HomeController
 * @author TDW
 * @date 2018年6月20日
 *
 */
@Controller
public class HomeController {

    @RequestMapping(value = "/")
    public String home(Model model) {
        return "WEB-INF/views/home.jsp";
    }

    
    @RequestMapping(value = "/publish", method = RequestMethod.POST)
    public String publish(Model model) {
        model.addAttribute("published", true);
        return home(model);
    }
    
    @RequestMapping(value="/test")
    @ResponseBody
    public String test(Integer orderId) {
        if(orderId == null)
        	return "{\"ret_msg\":\"orderId is "+orderId+"\"}";
        
        
    	 return "{\"ret_msg\":\"the msg is ok!\"}";
    }
    
}
